package com.yunfeisoft.base.service.impl;

import com.yunfeisoft.base.dao.inter.WorkflowTaskDao;
import com.yunfeisoft.base.model.WorkflowTask;
import com.yunfeisoft.base.service.inter.WorkflowTaskService;
import com.yunfeisoft.common.base.BaseServiceImpl;
import com.yunfeisoft.common.utils.Page;
import com.yunfeisoft.utils.WorkflowHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * ClassName: WorkflowTaskServiceImpl
 * Description: 流程实例执行service实现
 * Author: Jackie liu
 * Date: 2020-01-03
 */
@Service("workflowTaskService")
public class WorkflowTaskServiceImpl extends BaseServiceImpl<WorkflowTask, String, WorkflowTaskDao> implements WorkflowTaskService {

    @Autowired
    private WorkflowHelper workflowHelper;

    @Override
    public Page<WorkflowTask> queryPage(Map<String, Object> params) {
        return getDao().queryPage(params);
    }

    @Override
    public int modifyAndExecuteTask(String taskId, int status, String remark, String executor) {
        workflowHelper.executeTask(taskId, status, remark, executor);
        return 1;
    }

    @Override
    public int modifyAndSubmitProcess(String instanceId, String executor) {
        workflowHelper.submitProcess(instanceId, executor);
        return 1;
    }
}